package editor.tester;

import java.security.Permission;

/**
 * Catches system.exit() calls
 * 
 * @author Mark Dessain
 *
 */
public class ExitSecurityManager extends SecurityManager 
{       
	
    /* (non-Javadoc)
     * @see java.lang.SecurityManager#checkPermission(java.security.Permission)
     */
    @Override
    public void checkPermission(Permission perm) 
    {
            // allow anything.
    }
    /* (non-Javadoc)
     * @see java.lang.SecurityManager#checkPermission(java.security.Permission, java.lang.Object)
     */
    @Override
    public void checkPermission(Permission perm, Object context) 
    {
            // allow anything.
    }

    /* (non-Javadoc)
     * @see java.lang.SecurityManager#checkExit(int)
     */
    @Override 
    public void checkExit(int status) 
    {           
    	super.checkExit(status);   
        throw new SecurityException();     
    }     
    
}
